/*
 * @Descripttion:
 * @Author: voanit
 * @Date: 2022-03-22 08:47:18
 * @LastEditors: voanit
 * @LastEditTime: 2022-03-22 09:05:28
 */
import React from 'react'
import { useSelector, useDispatch } from 'react-redux'
const First = () => {
  const dispatch = useDispatch()
  const name = useSelector((state) => {
    console.log(state, 888)
    return state.user
  })
  const book = useSelector((state) => {
    return state.book
  })
  return (
    <div>
      御剑乘风来,除魔天地间!==First==={name}
      <ul>
        {book.map((item) => {
          return (
            <li
              onClick={() => {
                dispatch({
                  type: 'book/update',
                  payload: { id: item.id, name: 'lucy' },
                })
              }}
              key={item.id}
            >
              编号：{item.id} ===书名:{item.name}
            </li>
          )
        })}
      </ul>
    </div>
  )
}
export default First
